Skip to content

Conversation

@yoshidan
Copy link
Collaborator

@yoshidan yoshidan commented Dec 6, 2025

Description

This PR significantly refactors the architecture to switch from on-demand preimage generation to a continuous, always-on background generation model. This improves response latency and ensures preimages are readily available for finalized blocks.

Key Changes

  • Continuous Preimage Collection: Introduced PreimageCollector, which runs in the background to continuously fetch L1 finality updates and generate preimages for the range between the agreed L2 block and the finalized L2 block.

  • Decoupled Serving: The HTTP server now serves already generated preimages from the repository (FilePreimageRepository), decoupling the generation logic from the request path.
    L1 Finality Caching: Implementing FinalizedL1Repository to persistently store the latest finalized L1 headers.

  • API Updates:

    • get_preimage: Updated to return pre-generated data from storage.
    • get_finalized_l1: New endpoint to retrieve finalized L1 headers by hash.
    • get_latest_metadata & list_metadata: New endpoints for better visibility into the available preimages.
  • Concurrency & Maintenance:

    • Preimage collection supports parallel execution (max_concurrency).
    • Added PreimagePurger to automatically clean up expired preimages and headers based on TTL.

Naohiro Yoshida added 23 commits November 15, 2025 14:47
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan yoshidan marked this pull request as draft December 6, 2025 07:12
Naohiro Yoshida added 2 commits December 13, 2025 10:53
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan yoshidan changed the title Enable background preimage making Refactor to continuous background preimage generation and L1 finality caching Dec 14, 2025
@yoshidan yoshidan marked this pull request as ready for review December 14, 2025 01:39
@yoshidan yoshidan requested a review from Copilot December 14, 2025 01:39
Naohiro Yoshida added 5 commits December 14, 2025 12:55
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan yoshidan requested a review from siburu December 15, 2025 04:42
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan yoshidan requested review from siburu and removed request for siburu December 16, 2025 05:00
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@siburu
Copy link
Collaborator

siburu commented Dec 25, 2025

@yoshidan I still see the warning: This branch has conflicts that must be resolved.
It is necessary to fix some conflicts, right?

Naohiro Yoshida added 2 commits December 26, 2025 00:10
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan
Copy link
Collaborator Author

@siburu I fixed the conflict now.

@siburu siburu requested a review from ikehara December 26, 2025 06:10
Copy link

@ikehara ikehara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some findings were reported by AI. I reviewed them and commented on the actual issues.

Naohiro Yoshida added 4 commits January 8, 2026 17:16
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
@yoshidan yoshidan force-pushed the feature/v2 branch 2 times, most recently from c8d4331 to 5880fe4 Compare January 12, 2026 01:35
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
Copy link

@ikehara ikehara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any metrics we can check to see if it’s working properly?
I’m concerned that, without metrics, we won’t be able to monitor the progress of preimage generation.

@yoshidan
Copy link
Collaborator Author

Are there any metrics we can check to see if it’s working properly?
I’m concerned that, without metrics, we won’t be able to monitor the progress of preimage generation.

No dedicated metrics exist, but we can get the latest preimage metadata through the "/get_latest_metadata" API.
We can perform synthetic checks to see if the value stays the same for too long.

@yoshidan yoshidan merged commit 980eeff into main Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants